package learnjava.jvm;

public class TestInvoke {

    private void test1(){}

    public void test2(){}

    private final void test3(){}

    private static void test4(){}

    public static void main(String[] args) {
        TestInvoke ti = new TestInvoke();
        ti.test1();
        ti.test2();
        ti.test3();
        ti.test4(); //多余的代码，会产生不必要的虚拟机指令
        TestInvoke.test4();
        /**
         *  0 new           #2 <learnjava/jvm/TestInvoke>
         *  3 dup
         *  4 invokespecial #3 <learnjava/jvm/TestInvoke.<init>>
         *  7 astore_1
         *  8 aload_1
         *  9 invokespecial #4 <learnjava/jvm/TestInvoke.test1>
         * 12 aload_1
         * 13 invokevirtual #5 <learnjava/jvm/TestInvoke.test2>
         * 16 aload_1
         * 17 invokespecial #6 <learnjava/jvm/TestInvoke.test3>
         * 20 aload_1
         * 21 pop
         * 22 invokestatic  #7 <learnjava/jvm/TestInvoke.test4>
         * 25 invokestatic  #7 <learnjava/jvm/TestInvoke.test4>
         * 28 return
         */
    }
}
